/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package service.reportCenter.salesReports;

/**
 *
 * @author dchapman
 */
public enum SalesReportType {
    ALL_SALES_DATA(0),
    TAPROOM_SALES_DATA(1),
    OUTSIDE_SALES_DATA(2),
    CUSTOMER_SALES_DATA(3);

    private final int type;

    SalesReportType(final int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }

    public static SalesReportType getType(final String type) {
        return getType(Integer.parseInt(type));
    }

    public static SalesReportType getType(final int type) {
        switch (type) {
        case 0:
            return ALL_SALES_DATA;
        case 1:
            return TAPROOM_SALES_DATA;
        case 2:
            return OUTSIDE_SALES_DATA;
        case 3:
            return CUSTOMER_SALES_DATA;
        default:
            throw new EnumConstantNotPresentException(SalesReportType.class, String.valueOf(type));
        }
    }

    public static int getStateID(final String state) {
        if(state.equals("ALL_SALES_DATA")){
            return 0;
        }
        if(state.equals("TAPROOM_SALES_DATA")){
            return 1;
        }
        if(state.equals("OUTSIDE_SALES_DATA")){
            return 2;
        }
        if(state.equals("CUSTOMER_SALES_DATA")){
            return 3;
        }
        return 0;
    }
}
